﻿using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using TickSharp.Core.Interfaces;
using TickSharp.Core.Model;

namespace TickSharp.Core.Infrastructure.Serializers
{
    public class ClientSerializer : ISerializer<Client>
    {
        public IEnumerable<Client> Deserialize(XElement elements)
        {
            return from e in elements.Elements()
            select new Client
            {
                Id = int.Parse(e.Element("id").Value),
                Name = e.Element("name").Value
            };
        }
    }
}